package com.pig4cloud.pig.village.team.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.village.api.dto.TeamSelect;
import com.pig4cloud.pig.village.api.entity.Team;
import com.pig4cloud.pig.village.team.service.ITeamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author limbray.li
 * @date 2021/6/26
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/team")
@Api(value = "team", tags = "生产队-组")
public class TeamController {
	@Resource
	private ITeamService teamService;

	@ApiOperation(value = "分页")
	@GetMapping("/page")
	public R<IPage<Team>> page(Integer pageNum, Integer pageSize) {
		return R.ok(teamService.page(new Page(pageNum,pageSize)));
	}

	@ApiOperation(value = "查询全部组-all")
	@GetMapping("/listTeamAllSelect")
	public R<List<TeamSelect>> listTeamAllSelect() {
		return R.ok(teamService.listAllSelect());
	}

}
